﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControl_RegStep : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Msg.Text = String.Empty;
        }
    }
    protected void UserNameTest_Click(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(CreateUserWizard1.UserName) || CreateUserWizard1.UserName.Trim().Length == 0) return;
        MembershipUserCollection usercol = Membership.FindUsersByName(CreateUserWizard1.UserName);
        if (usercol.Count != 0)
            Msg.Text = "该用户名已被注册！";
        else
            Msg.Text = "该用户名可用！";
    }
    
    //尝试通过 UserName 的 TextChanged 事件来触发异步回传，但不成功，why?
    protected void ButtonCancel_Click(object sender, EventArgs e)
    {
        Response.Redirect("Login.aspx");
    }
}
